<h1 class="page-header">订单信息</h1>

<div ng-controller="orderDetailCtrl">

    <div class="row">
        <div class="col-xs-3">

            <label>订单编号:</label>
            <span ng-bind="order.id"></span>

        </div>
        <div class="col-xs-3">
            <label>下单日期:</label>
            <span ng-bind="order.orderDate"></span>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-3">

            <label>用户信息:</label>
            <table class="table table-bordered">
                <tr>
                    <td width="100">用户名：</td>
                    <td ng-bind="order.memberName"></td>
                </tr>
                <tr>
                    <td>电话：</td>
                    <td ng-bind="order.memberPhone"></td>
                </tr>
                <tr>
                    <td>用户等级：</td>
                    <td ng-bind="order.levelName"></td>
                </tr>
                <tr>
                    <td>会员折扣：</td>
                    <td ng-bind="order.levelDiscount"></td>
                </tr>
            </table>

        </div>
        <div class="col-xs-3">

            <label>发货信息:</label>
            <table class="table table-bordered">
                <tr>
                    <td>收货人：</td>
                    <td ng-bind="order.contact"></td>
                </tr>
                <tr>
                    <td>联系电话：</td>
                    <td ng-bind="order.phone"></td>
                </tr>
                <tr>
                    <td width="100">邮政编码：</td>
                    <td ng-bind="order.zipCode"></td>
                </tr>
                <tr>
                    <td>详细地址：</td>
                    <td ng-bind="order.province + order.city + order.county + order.shippingAddress"></td>
                </tr>
                <tr>
                    <td>送货方式：</td>
                    <td ng-if="order.deliveryType == 0">门店自提</td>
                    <td ng-if="order.deliveryType == 1">快递</td>
                    <td ng-if="order.deliveryType == 2">私人酒窖</td>
                </tr>
                <tr ng-if="order.deliveryType == 1">
                    <td>快递公司：</td>
                    <td ng-bind="order.shippingCompany"></td>
                </tr>
                <tr ng-if="order.deliveryType == 1">
                    <td>快递编号：</td>
                    <td ng-bind="order.trackingNum"></td>
                </tr>
                <tr ng-if="order.deliveryType == 0">
                    <td>门店名称：</td>
                    <td ng-bind="store.name"></td>
                </tr>
                <tr ng-if="order.deliveryType == 0">
                    <td>门店电话：</td>
                    <td ng-bind="store.phone"></td>
                </tr>
                <tr ng-if="order.deliveryType == 0">
                    <td>门店地址：</td>
                    <td ng-bind="store.province + store.city + store.county + store.address"></td>
                </tr>
            </table>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-8">
            <label>订单详细:</label>
            <table class="table table-bordered">
                <tr>
                    <th width="250px">产品名称</th>
                    <th>数量</th>
                    <th>产品价格</th>
                    <th>实际价格</th>
                    <th>私人酒窖(是/否)</th>
                </tr>
                <tr ng-repeat="item in order.orderItemList">
                    <td ng-bind="item.goodsName"></td>
                    <td ng-bind="item.qty"></td>
                    <td ng-bind="item.goodsPrice.toFixed(2) + '元'"></td>
                    <td ng-bind="item.price.toFixed(2) + '元'"></td>
                    <td ng-bind="typeof(item.myListItemId) != 'undefined' && item.myListItemId.length > 0 ? '是' : '否'"></td>
                </tr>
                <tr>
                    <td>折扣:</td>
                    <td colspan="4" align="center" ng-bind="order.discount.toFixed(2) + '元'"></td>
                </tr>
                <tr>
                    <td>小计:</td>
                    <td colspan="4" align="center" ng-bind="order.subTotal.toFixed(2) + '元'"></td>
                </tr>
                <tr>
                    <td>总计:</td>
                    <td colspan="4"  align="center" ng-bind="order.total.toFixed(2) + '元'"></td>
                </tr>
            </table>
        </div>
     </div>

    <a class="btn btn-primary" ui-sref="index.orderMng">返回</a>

    <a class="btn btn-success" ng-show="order.deliveryType == 1" data-target="#shippingInfoModal" data-toggle="modal" >快递信息</a>

    <a class="btn btn-success" ng-show="order.status == 2 && order.deliveryType == 1" data-target="#shippedModal" data-toggle="modal" ng-click="getShippedInfo();">发货</a>

    <div class="modal fade" id="shippingInfoModal" tabindex="-1" role="dialog"  aria-labelledby="shippingInfoModal" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        发货
                    </h4>
                </div>
                <div class="modal-body">
                    <div>
                        <div>
                            <label>订单编号:</label>
                            <span ng-bind="order.id"></span>
                        </div>

                        <div>
                            <label>快递公司:</label>
                            <input class="form-control" ng-model="order.shippingCompany">
                        </div>

                        <div>
                            <label>快递编号:</label>
                            <input class="form-control" ng-model="order.trackingNum">
                        </div>

                    </div>

                </div>
                <p class="bg-danger"></p>
                <span class="success-message"></span>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <input type="button" value="确定" class="btn btn-warning" ng-click="shippingInfo();"/>

                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="shippedModal" tabindex="-1" role="dialog"  aria-labelledby="shippedModal" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        发货
                    </h4>
                </div>
                <div class="modal-body">
                    <div>
                        <div>
                            <label>订单编号:</label>
                            <span ng-bind="order.id"></span>
                        </div>

                        <div ng-show="myListMember.list.length > 0">
                            <p class="alert-danger">注意:在确认发货后, 系统会给以下item给窖主账户充值</p>
                            <table class="table table-bordered">
                                <tr>
                                    <th>窖主名</th>
                                    <th>产品名称</th>
                                    <th>数量</th>
                                    <th>价格</th>
                                    <th>小计</th>
                                </tr>
                                <tr ng-repeat="item in myListMember.list">
                                    <td ng-bind="item.memberName"></td>
                                    <td ng-bind="item.goodsName"></td>
                                    <td ng-bind="item.qty"></td>
                                    <td ng-bind="item.price.toFixed(2) + '元'"></td>
                                    <td ng-bind="item.total.toFixed(2) + '元'"></td>
                                </tr>

                            </table>
                        </div>

                    </div>

                </div>
                <p class="bg-danger"></p>
                <span class="success-message"></span>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <input type="button" value="确定" class="btn btn-warning" ng-click="shipOrder();"/>

                </div>
            </div>
        </div>
    </div>

</div>
